/*
 * OpenSCAD File with the code to draw a part of the quadcopter in 3D
 * Part Number: 07
 * Version: 0.01
 * Units: mm
 * Last Modification: Sun Jun 27 23:49:50 WEST 2010
 *
 * Copyright (C) 2010 Henrique Dias <henrique.ribeiro.dias@gmail.com>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

frominclude = 0;

module p7_wing()
{
	translate(v = [((15.5-2)/2)+2, (19+7-1-6)/2, 0]) {
		cube(size = [15.5-2, 19+7-1-6, 2], center=true);
	}
	translate(v = [((15.5-2-6)/2)+2, (19+7-1)/2, 0]) {
		cube(size = [15.5-2-6, 19+7-1, 2], center=true);
	}
	translate(v = [9.5, 19, 0]) {
		cylinder(h=2, r=6, center=true, $fn=60);
	}
}

module p7_subcomponent()
{
	cylinder(h=9, r=2, center=true, $fn=60);
	translate(v = [15.5, 0, 0]) {
		cylinder(h=9, r=1, center=true, $fn=60);
	}
	rotate(a=[90,0,0]) {
		translate(v = [0, 0, -(18/2)-7]) {
			cylinder(h=18, r=2, center=true, $fn=60);
		}
	}
	// hole in wing
	translate(v = [9.5, 19, 0]) {
		cylinder(h=3, r=4, center=true, $fn=60);
	}
	translate(v = [((15.5-8)/2)+4.75, -(6/2)+1.5, 0]) {
		cube(size = [15.5-8, 6, 4], center=true);
	}
}

module p7_addcomponent()
{
	cylinder(h=9, r=4.5, center=true, $fn=60);
	translate(v = [15.5, 0, 0]) {
		cylinder(h=9, r=3, center=true, $fn=60);
	}
	translate(v = [(15.5)/2, 0, 0]) {
		cube(size = [15.5, 8, 8], center=true);
	}
	translate(v = [0, (7)/2, 0]) {
		cube(size = [8, 7, 8], center=true);
	}
	rotate(a=[90,0,0]) {
		translate(v = [0, 0, -(19/2)-7+1]) {
			cylinder(h=19, r=4, center=true, $fn=60);
		}
	}
	p7_wing();
}

module part07()
{
	difference() {
		union() {
			p7_addcomponent();
		}
		p7_subcomponent();
	}
}

if(frominclude == 0) {
	part07();
}